﻿using System;
using System.ComponentModel;
using System.Globalization;

namespace YArchitech.Controls.ImgListView
{
	internal class ColumnHeaderCollectionTypeConverter : TypeConverter
	{
		public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
		{
			return destinationType == typeof(string) || base.CanConvertTo(context, destinationType);
		}

		public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
		{
			if (value is ImageListView.ImageListViewColumnHeaderCollection && destinationType == typeof(string))
			{
				return "(Collection)";
			}
			return base.ConvertTo(context, culture, value, destinationType);
		}
	}
}
